<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=1024">
        <title>测试111111</title>
        <script src="/js/webim.config.js"></script>
        <script src='/js/strophe-1.2.8.min.js'></script>
        <script src='/js/websdk-1.4.12.min.js'></script>
        <link type="text/css" rel="stylesheet" href="/css/im.css"/>
    </head>
    <body>
        <input type="button" onclick="login()" value="登录" />
        <div class="im-box">
            <div class="im-title">
                <img class="im-avater" src="/image/avater.jpg" />
                我和摸摸聊天
                <span class="im-close" >关闭</span>
            </div>
            <ul class="im-messages" id="im-messages">

            </ul>
            <div class="im-send">
                <ul class="im-tools">
                    <li class="im-tools-emoji">emoji</li>
                </ul>
                <textarea id="sentMessage" class="im-send-text" placeholder="输入聊天内容"></textarea>
                <button onclick="sendMessage()" class="im-send-btn">发送</button>
            </div>
        </div>

        <script>
            var hxim = new hxim();
            // hxim.setCookie('im-username','cyy2',60 * 60 *24 *30);
            // hxim.setCookie('im-token','YWMtInKqFILrEee8nEkRmGdyDoa0WwBDeRHnuWTz830i_UadJEKwgoUR546vK3Dfjb33AwMAAAFd7czF3wBPGgBILD9iiT3U6kLlySRnJHyNmX-Sg5d3kMiUIZHcPyC3dQ',60 * 60 *24 *30);
            function login(){
                hxim.login('cyy2','123456','',function(token){
                    console.log("登录成功token:"+token);
                },function(){
                    console.log('登录失败');
                });
                

            function sendMessage(){
                var msgObj = document.getElementById("sentMessage");
                if(msgObj.value == ""){
                    return ;
                }
                hxim.sendText('cyy',msgObj.value,function(id,serverMsgId){
                    msgObj.value = '';
                },function(){
                    console.log("发送错误");
                });
            }
        </script>
    </body>
</html>
